#pragma once

#include "HandwritingIdentificationDoc.h"

// CDlgBatchTest dialog

struct PixelNum{
	string  fullpath; 
	double  similar;
};

class CDlgBatchTest : public CDialog
{
	DECLARE_DYNAMIC(CDlgBatchTest)

public:
	CDlgBatchTest(CWnd* pParent = NULL);   // standard constructor
	virtual ~CDlgBatchTest();

	HDIB GetHDIB() const
		{ return m_hDIB; }
	CPalette* GetDocPalette() const
		{ return m_palDIB; }
	CSize GetDocSize() const
		{ return m_sizeDoc; }
	CDibImage* GetDibImage() const
		{ return m_pDibImage; }
	CDibImage* m_pDibImage;
	HDIB m_hDIB;
	CPalette* m_palDIB;
	CSize m_sizeDoc;
	CString GetPath();

// Dialog Data
	enum { IDD = IDD_DLGBATCHTEST };

	CString       m_dirname;
	CString       m_savefn;
	CProgressCtrl m_ctrlProgress;
private:
	int nTotalItem;
	int total_img_num;
	int nTopHitLimited;
	int num_top_one_hit;
	int num_top_three_hit;
	int num_top_five_hit;
	int num_top_ten_hit;
	int num_top_fifteen_hit;
	int num_top_twenty_hit;

private:
	string getwritername(string& name);
	string getname(string& name);
	void CreateResultDlg(FILE *fout);
	void GetTopHitLimitedNum();
	void GetTopHitLimited(FILE *fout, string & fullname, string & name, vector <PixelNum>& vec);
	void Eucdistanceske(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath, int m_CheckRadio);
	void Chidistanceske(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath, int m_CheckRadio);
	void Weighteucske(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath, int m_CheckRadio);
	void Weightchiske(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath, int m_CheckRadio);
	void Weightmanhattan(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath, int m_CheckRadio);
	void Gbw1(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath);
	void Gbw2(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath);
	void Gbw3(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath);
	void Wr1(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath);
	void Wr2(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath);
	void Deviation(vector < vector <PixelNum> >& imagevec, vector <LPCTSTR>& fullpath);

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()

public:
	afx_msg void OnBnClickedBtnBatchTestPath();
	afx_msg void OnBnClickedBtnBatchTestSave();
	afx_msg void OnBnClickedBtnBatchtestStart();
	virtual BOOL OnInitDialog();
public:
	afx_msg void OnBnClickedCheckTest0();
public:
	afx_msg void OnBnClickedCheckTest1();
public:
	afx_msg void OnBnClickedCheckTest2();
public:
	afx_msg void OnBnClickedCheckTest3();
public:
	afx_msg void OnBnClickedCheckTest4();
public:
	afx_msg void OnBnClickedCheckTest5();
public:
	afx_msg void OnBnClickedCheckTest6();
public:
	afx_msg void OnBnClickedCheckTest7();
public:
	afx_msg void OnBnClickedCheckTest8();
public:
	afx_msg void OnBnClickedCheckTest9();
};
